home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
pubdom.tar
/
pubdom
/
rbj
/
drawseg
< prev
next >
Wrap
Text File
|
1990-05-30
|
3KB
|
47 lines
%%HP: T(3)A(D)F(.);
@ DRAWSEG Program - Segment of a circle. To be in SEG
@ RBJ 5/30/90 Top Dead Center (TDC) at { 64, 1 }
@
\<< @ Create, Remove Local Variables
\<< R\->B SWAP
R\->B SWAP
2 \->LIST
\>>
0 0 0 0 0 64 \-> f @ Function x y -> {#x #y}
pf @ Pixel Conversion Factor
y @ Y Coordinate of Chord
c @ {x,y} of Center of Circle
cl cr @ {x,y} Chord Left, Right
x @ X coordinate of Centerline
\<< @ MAIN BODY OF DRAWSEG
ERASE { #0d #0d } PVIEW @ Blank out the screen
Ch 128 / @ Real to Pixel Factor based on
Ri 54 / MAX 'pf' STO @ 128 horiz, 54 Vertical
x @ X coord of Center
Ra pf / 1 + @ Y Coord of Center
f EVAL DUP 'c' STO @ { X, Y} (and Save copy)
Ra pf / R\->B @ Radius in pixels
An 2 / DUP @ Half Angle
NEG 90 + SWAP 90 + @ Start Stop Angle 90-A/2, 90+A/2
ARC @ Draw the Arc
x 1 f EVAL @ TDC - One end of Rise { x, y }
x @ Compute bottom of rise,
Ri pf / 1 + DUP 'y' STO @ Save bottom coodinate
f EVAL LINE @ Pixel List, Draw Line
Ch 2 / pf / DUP @ Half Chord Pixel Count
NEG x + SWAP x + @ Left, Right Coordinates
SWAP y f EVAL DUP 'cl' STO @ { XL, Y }
SWAP y f EVAL DUP 'cr' STO @ { XR, Y }
LINE @ Draw chord
cl c LINE @ Draw Center to Chord Left
cr c LINE @ Draw Center to Chord Right
An 4 / DUP @ Draw radius at Angle/4
SIN Ra * pf / x + @ X Component + 64 pixels
SWAP COS NEG 1 + Ra * pf / 1 + @ Y Component + 1 pixel
f EVAL @ Make { X, Y }
c LINE @ Draw to Center of Circle
3 FREEZE @ Hold Screen
\>>
\>>